<%@ page import="com.wwdx.shiro.SessionUser" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<html>
<head>
    <jsp:include page="/public/inc/head.jsp"/>
</head>
<body>
<div id="header" class="navbar navbar-static-top" role="navigation">
    <jsp:include page="/public/inc/top.jsp"/>
</div>
<div class="container-fluid" style="margin-top:5px;margin-bottom:60px;">
    <div class="row">
        <jsp:include page="/public/inc/menu.jsp"/>
        <div class="col-xs-12 col-sm-10">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <div class="media">
                        <div class="media-body">
                            <span class="glyphicon glyphicon-list"></span> vip产品管理
                        </div>
                        <shiro:hasAnyRoles name="super,admin">
                            <div class="media-right">
                                <a href="/system/wwdx_vip_product/create" class="btn btn-primary">
                                    <span class="glyphicon glyphicon-plus"></span> vip产品添加
                                </a>
                            </div>
                        </shiro:hasAnyRoles>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>编码</th>
                            <th>产品编号</th>
                            <th>产品名称</th>
                            <th>原价</th>
                            <th>现价</th>
                            <th>是否可用</th>
                            <th>类型</th>
                            <th>排序</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="l" items="${list}" varStatus="status">
                            <tr>
                                <td>
                                        ${status.index + 1}
                                </td>
                                <td>
                                        ${l.product_id}
                                </td>
                                <td>
                                        ${l.product_name}
                                </td>
                                <td>
                                        ${l.original_price}
                                </td>
                                <td>
                                        ${l.price}
                                </td>
                                <td>
                                    <c:choose>
                                        <c:when test="${l.status eq 1 }">
                                            <span class="btn btn-danger btn-xs">是</span>
                                        </c:when>
                                        <c:when test="${l.status eq 0 }">
                                            <span class="btn btn-primary btn-xs">否</span>
                                        </c:when>
                                        <c:otherwise>
                                            <span class="btn btn-primary btn-xs">待定</span>
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <td>
                                    <c:choose>
                                        <c:when test="${l.type eq 5 }">
                                            <span class="btn btn-danger btn-xs">三天</span>
                                        </c:when>
                                        <c:when test="${l.type eq 6 }">
                                            <span class="btn btn-danger btn-xs">五天</span>
                                        </c:when>
                                        <c:when test="${l.type eq 1 }">
                                            <span class="btn btn-danger btn-xs">一周</span>
                                        </c:when>
                                        <c:when test="${l.type eq 4 }">
                                            <span class="btn btn-danger btn-xs">半月</span>
                                        </c:when>
                                        <c:when test="${l.type eq 2 }">
                                            <span class="btn btn-primary btn-xs">一月</span>
                                        </c:when>
                                        <c:when test="${l.type eq 8 }">
                                            <span class="btn btn-primary btn-xs">三月</span>
                                        </c:when>
                                        <c:when test="${l.type eq 9 }">
                                            <span class="btn btn-primary btn-xs">半年</span>
                                        </c:when>
                                        <c:when test="${l.type eq 10}">
                                            <span class="btn btn-primary btn-xs">一年</span>
                                        </c:when>
                                        <c:otherwise>
                                            <span class="btn btn-primary btn-xs">待定</span>
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <td>
                                        ${l.sort}
                                </td>
                                <td>
                                    <fmt:formatDate value="${l.gmt_created}" pattern="yyyy-MM-dd HH:mm:ss"/>
                                </td>
                                <td>
                                    <shiro:hasAnyRoles name="super,admin">
                                        <a class="btn btn-primary btn-xs"
                                           href="/system/wwdx_banner/create?id=${l.product_id}&bannertype=7">
                                            推荐首页
                                        </a>
                                        <a class="btn btn-primary btn-xs" href="/system/wwdx_vip_product/edit?id=${l.id}">
                                            <span class="glyphicon glyphicon-pencil"></span> 修改
                                        </a>
                                    </shiro:hasAnyRoles>
                                    <c:if test='<%=SessionUser.getMerchantId() != null && !"".equals(SessionUser.getMerchantId())%>'>
                                        <a class="btn btn-primary btn-xs"
                                           href="/system/wwdx_merchant_product/save?type=1&product_id=${l.product_id}&merchant_id=<%=SessionUser.getMerchantId()%>">
                                            添加分销产品
                                        </a>
                                    </c:if>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
                <div class="panel-footer">
                    <p:pagination url="/system/wwdx_vip_product/list" total="${listSize}"/>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/public/inc/bottom.jsp"/>
</body>
</html>